<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>批改作业 - 析码无界</title>
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <script src="http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
    <style>
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background-color: #f5f5f5;
            padding-top: 20px;
        }
        .panel {
            border: none;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            border-radius: 8px;
        }
        .panel-heading {
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 8px 8px 0 0;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-check-square"></i> 待批改作业</h3>
            </div>
            <div class="panel-body">
                <a th:href="@{/assignment/list}" class="btn btn-default" style="margin-bottom: 20px;">
                    <i class="fa fa-arrow-left"></i> 返回列表
                </a>
                
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>标题</th>
                            <th>发布时间</th>
                            <th>截止时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr th:if="${#lists.isEmpty(assignments)}">
                            <td colspan="4" class="text-center">暂无待批改作业</td>
                        </tr>
                        <tr th:each="assignment : ${assignments}">
                            <td th:text="${assignment.title}"></td>
                            <td th:text="${#dates.format(assignment.publishTime, 'yyyy-MM-dd HH:mm')}"></td>
                            <td th:text="${#dates.format(assignment.deadline, 'yyyy-MM-dd HH:mm')}"></td>
                            <td>
                                <form th:action="@{/assignment/finishGrading}" method="post" style="display: inline;">
                                    <input type="hidden" name="id" th:value="${assignment.id}"/>
                                    <button type="submit" class="btn btn-sm btn-success">
                                        <i class="fa fa-check"></i> 完成批改
                                    </button>
                                </form>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</body>
</html>

